/* eslint-disable */
// 该文件由 OneAPI 自动生成，请勿手动修改！
import {apiPrefixDispose} from '@/utils/format';
import {request} from '@umijs/max';


/**
 * 分页查询
 */
export async function dictPage<T = any>(body: API.DictionaryPage) {
  return request<API.ResultPageVO<API.Dictionary>>(apiPrefixDispose('/dict/page'), {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
  });
}


/**
 * 新增字典表
 */
export async function addDict<T = any>(body: API.DictionaryAdd) {
  return request<API.ResultVO<string>>(apiPrefixDispose('/dict/append'), {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
  });
}



/**
 * 查询角色集(只有正常的角色)
 */
export async function roles<T = any>() {
  return request<API.ResultVO<API.RoleVO[]>>(apiPrefixDispose('/role/roles'), {
    method: 'GET',
  });
}


/**
 * 删除字典表
 */
export async function deleteByCodes<T = any>(
  ids: Array<number>,
  options?: { [key: string]: any },
) {
  return request<API.ResultVO<string>>(apiPrefixDispose('/dict/delete'), {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: ids,
    ...(options || {}),
  });
}



/**
 * 有效集合
 */
export async function dbTypes<T = any>() {
  return request<API.ResultVO<Array<API.Dictionary>>>(apiPrefixDispose('/dict/lists/efficacious'), {
    method: 'GET',
  });
}



/**
 * 查询单层子级
 */
export async function subLevel<T = any>( parentCode: string) {
  return request<API.ResultVO<API.Dictionary[]>>(apiPrefixDispose(`/dict/subLevel/${parentCode}`), {
    method: 'GET',
  });
}


/**
 * 字典树
 */
export async function tree<T = any>() {
  return request<API.ResultVO<[]>>(apiPrefixDispose('/dict/tree'), {
    method: 'GET',
  });
}



/**
 * 禁用角色
 */
export async function disable<T = any>(
  code: string,
  options?: { [key: string]: any },
) {
  return request<API.ResultVO<string>>(apiPrefixDispose('/dict/disable'), {
    method: 'GET',
    params: { 'code': code },
    ...(options || {}),
  });
}


/**
 * 启用角色
 */
export async function enabled<T = any>(
  code: string,
  options?: { [key: string]: any },
) {
  return request<API.ResultVO<string>>(apiPrefixDispose('/dict/enabled'), {
    method: 'GET',
    params: { 'code': code },
    ...(options || {}),
  });
}


/**
 * 修改字典基础信息
 */
export async function editBaseInfo<T = any>(
  edit: API.DictionaryBaseInfo,
  options?: { [key: string]: any },
) {
  return request<API.ResultVO<string>>(apiPrefixDispose('/dict/editBaseInfo'), {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: edit,
    ...(options || {}),
  });
}


/**
 * 修改字典排序
 */
export async function editSort<T = any>(
  edit: API.DictionaryFixSort,
  options?: { [key: string]: any },
) {
  return request<API.ResultVO<string>>(apiPrefixDispose('/dict/fixSort'), {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: edit,
    ...(options || {}),
  });
}